﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;

namespace EstateappraisalApi.Controllers
{
    /// <summary>
    /// 区位状况
    /// </summary>
    public class LocationController : ApiController
    {
        // GET api/location
        LocationBLL bll = new LocationBLL();

        /// <summary>
        /// 获取相应的区位状况勘察
        /// </summary>
        /// <param name="projectNumber"></param>
        /// <returns></returns>
        public IEnumerable<Location> Get(string projectNumber)
        {
            return bll.ShowLocation(projectNumber);
        }

        // GET api/location/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/location
        
        /// <summary>
        /// 添加区位状况
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        public int Post([FromBody]Location m)
        {
            m.location_CreatePeople = "1";
            m.location_CreateTime = DateTime.Now;
            if (bll.AddLocation(m))
            {
                return 1;
            }
            else
            {
                return 0;
            }

        }

        // PUT api/location/5
        public void Put(int id, [FromBody]string value)
        {


        }

        // DELETE api/location/5
        public void Delete(int id)
        {


        }
    }
}
